package com.mspbots.api.service.impl;

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonNode;
import com.mspbots.api.service.TenantTimeZoneService;
import com.mspbots.cw.request.TimeZoneSetupDTO;
import org.springframework.stereotype.Service;
import reactor.core.publisher.Mono;

import java.util.List;

/**
 * com.mspbots.api.service.impl.TenantTimeZoneServiceImpl
 *
 * @author Alex bob(https://github.com/vnobo)
 * @date Created by 2019/7/15
 */
@Deprecated
@Service
public class TenantTimeZoneServiceImpl extends BaseGenericService implements TenantTimeZoneService {

    @Override
    public List<TimeZoneSetupDTO> addBatch(List<TimeZoneSetupDTO> dtos) {
        Mono<JsonNode> resultMono = this.apiClient.post("/tenant/time-zone/add-batch", dtos);
        JsonNode result = resultMono.block();
        return this.objectMapper.convertValue(result, new TypeReference<List<TimeZoneSetupDTO>>() {
        });
    }
}
